package chapter3;

/**
 * @author ycj
 * @version 1.0
 * @description: TODO
 * @date 2022/5/17
 */

//基于双重检测锁定的正确单例模式 懒加载
public class Source3_17 {

}

class SingleTom{
    private static volatile SingleTom singleTom;

    private SingleTom() {
    }

    public SingleTom getSingleTom(){
        if(singleTom==null){
            synchronized(SingleTom.class){
                if(singleTom==null){
                    singleTom=new SingleTom();
                }
            }
        }

        return singleTom;
    }
}
